package com.hsy.bibc.modules.login;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.deparse.dpframe.utils.DPLogUtil;
import com.hsy.bibc.R;
import com.hsy.bibc.common.Config;
import com.hsy.bibc.common.Consts;
import com.hsy.bibc.modules.common.CommonBaseActivityWithSimpleActionBar;
import com.hsy.bibc.utils.CommonUtils;

/**
 * Created by Administrator on 2016/6/15.
 */
public class TextAPIActivity extends CommonBaseActivityWithSimpleActionBar {
    private EditText text_api_edit;
    private Button finish;
    private int clickRound = 1;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("API");
        setContentView(R.layout.activity_text_api);

        text_api_edit = F(R.id.text_api_edit);
        finish = F(R.id.finish);
        finish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                DPLogUtil.d("clickRound=" + clickRound);
                if (isEmpty(text_api_edit.getText().toString())) {
                    clickRound = 1;
                    return;
                }
                if (3 == clickRound) {

                    if (text_api_edit.getText().toString().equals("1")) {
                        Config.isOnline = false;
                    } else {
                        Config.isOnline = true;
                    }
                    DPLogUtil.d("clickRound=" + clickRound);
                    DPLogUtil.d("Config.API_SERVER=" + Config.API_SERVER);
                    DPLogUtil.d(" Config.isOnline=" + Config.isOnline);
                    setCons();
                    CommonUtils.hideProgressDialog();
                    finish();

                } else {
                    clickRound++;

                }

            }
        });

    }

    private void setCons() {
        CommonUtils.showProgressDialog(this);
        Consts.API_POST_SEND_SMS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/sendSms";

        Consts.API_POST_REG_SMS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/regSms";
        Consts.API_POST_REG_STEP = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/regStep";
        Consts.API_POST_REG = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/reg";

        Consts.API_POST_LOGIN = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/login";
        Consts.API_POST_FORGET_PASS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/forgetPass";

        Consts.API_GET_HD_HOTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/hots.html";
        Consts.API_GET_WYS_HOTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/hots.html";
        Consts.API_GET_WBS_HOTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/hots.html";
        Consts.API_GET_DISCOVERY_ACTIVITY_CATS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/cats.html";
        Consts.API_GET_DISCOVERY_SERVICE_WYS_CATS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/cats.html";
        Consts.API_GET_DISCOVERY_SERVICE_WBS_CATS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/cats.html";
        Consts.API_GET_DISCOVERY_ACTIVITY_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/lists.html";
        Consts.API_GET_DISCOVERY_SERVICE_WYS_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/lists.html";
        Consts.API_GET_DISCOVERY_SERVICE_WBS_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/lists.html";

        Consts.API_GET_QZ_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/lists.html";
        Consts.API_POST_QZ_COLLECT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/collect.html";

        Consts.API_GET_BEFORE_PUBLISH_ACT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/beforePub.html";
        Consts.API_GET_BEFORE_PUBLISH_WYS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/beforePub.html";
        Consts.API_GET_BEFORE_PUBLISH_WBS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/beforePub.html";

        Consts.API_COMMIT_PUB_ACT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/pub.html";
        Consts.API_COMMIT_PUB_WYS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/pub.html";
        Consts.API_COMMIT_PUB_WBS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/pub.html";
        Consts.API_COMMIT_PUB_QZ = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/pub.html";


        Consts.API_GET_NEWS_ZX_LIST = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Zx/lists";
        Consts.API_GET_NEWS_ZX_HOTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Zx/hots";
        Consts.API_GET_NEWS_ZX_DETAIL = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Zx/detail";

        Consts.API_GET_MY_INFO = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/my";

        Consts.API_GET_MY_CHANGE_NAME = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/chgNickname";
        Consts.API_GET_MY_CHANGE_SEX = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "User/chgSex";
        Consts.API_POST_MY_CHANGE_PASSWORD = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "User/chgPassword";
        Consts.API_POST_MY_CHANGE_AVATAR = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/chgAvatar";


        Consts.API_GET_MY_WYS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myWys";
        Consts.API_GET_MY_WEBS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myWbs";
        Consts.API_GET_MY_HD = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myHd";
        Consts.API_GET_MY_JOIN_HD = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myJoinHd";
        Consts.API_GET_MY_QUAN = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myQuan";

        Consts.API_GET_MY_COLLECT_HD = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/myOrder";
        Consts.API_GET_MY_COLLECT_WYS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myCollectWys";
        Consts.API_GET_MY_COLLECT_WBS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/myCollectWbs";


        Consts.API_GET_MY_DEL_WYS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/delWys";
        Consts.API_GET_MY_DEL_WBS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/delWbs";
        Consts.API_GET_MY_DEL_HD = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/delHd";
        Consts.API_GET_MY_DEL_QUAN = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/delQuan";

        Consts.API_UPLOAD_IMAGES = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/imgsUpload";
        Consts.API_UPLOAD_IMAGE = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Public/imgUpload";

        Consts.API_GET_MY_HD_DETAIL = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/detail";
        Consts.API_GET_MY_WBS_DETAIL = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/detail";
        Consts.API_GET_MY_WYS_DETAIL = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/detail";

        Consts.API_GET_HD_COMMENTS_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/comments";
        Consts.API_GET_WYS_COMMENTS_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/comments";
        Consts.API_GET_WBS_COMMENTS_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/comments";
        Consts.API_GET_QUAN_COMMENTS_LISTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/comments";

        Consts.API_ACT_REPLY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/reply";
        Consts.API_ACT_COMMENT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/sendComment";
        Consts.API_WYS_REPLY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/reply";
        Consts.API_WYS_COMMENT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/sendComment";
        Consts.API_WBS_REPLY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/reply";
        Consts.API_WBS_COMMENT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/sendComment";
        Consts.API_QUAN_REPLY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/reply";
        Consts.API_QUAN_COMMENT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/sendComment";

        Consts.API_ACT_UNLIKE = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/unlike";
        Consts.API_WYS_UNLIKE = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/unlike";
        Consts.API_WBS_UNLIKE = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/unlike";

        Consts.API_WBS_COLLECT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wbs/collect";
        Consts.API_WYS_COLLECT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Wys/collect";
        Consts.API_HD_COLLECT = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/collect";

        Consts.API_GET_SEARCH = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Search/search";
        Consts.API_POST_BAOMING = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Hd/baoming";

        Consts.API_GET_CONTACTS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "My/friends";


        Consts.Apis.POST_AUTH_LOGIN = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Auth/login";

        Consts.Apis.GET_QUANZI_DONGTAI = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/dongtai";
        Consts.Apis.GET_CIRCLE_NEWS_NUM = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Quan/newMsg";
        Consts.Apis.GET_RECENT_RECORDS = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/home.html";
        Consts.Apis.GET_SHOP_MY_WASTE = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/myWasteStock";
        Consts.Apis.GET_SHOP_MY_SHOP = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Shop/myGoodsStock";
        Consts.Apis.POST_SCAN_FP = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Scan/fpQrcode";
        Consts.Apis.POST_FP_MAKER_ORDER = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Fp/makeOrder";

        Consts.Apis.GET_ORDER_DETAIL_FP = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Fp/detail.html";
        Consts.Apis.GET_ORDER_DETAIL_DH = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Dh/detail.html";
        Consts.Apis.GET_ORDER_DETAIL_SY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Sy/detail.html";

        Consts.Apis.GET_CONFIRM_FP = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Fp/confirmOrder";
        Consts.Apis.GET_CONFIRM_DH = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Dh/confirmOrder";
        Consts.Apis.GET_CONFIRM_SY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Sy/confirmOrder";
        Consts.Apis.POST_CONFIRM_DH = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Dh/confirmDh";

        Consts.Apis.GET_USER_INFO = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Scan/xfQrcode";
        Consts.Apis.POST_COMMIT_SY = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Sy/doSy";
        Consts.Apis.POST_COMMIT_DH = (Config.isOnline ? Config.API_SERVER_ONLINE : Config.API_SERVER) + "Dh/duihuan";
    }
}
